import React, { Component } from 'react'
import {Card,Form, Input, Button, Checkbox} from "antd"
import {connect} from "dva"
import styles from "./index.css"

@connect()
export default class Login extends Component {
    login_do=(params)=>{
        const {dispatch}=this.props;
        dispatch({
            type:"user/login",
            payload:params
        })
    }
    render() {
        return (
            <div className={styles.login_box}>
                <Card className={styles.input_box}>
                <Form
                    name="basic"
                    initialValues={{ remember: true }}
                    onFinish={this.login_do}
                    >
                    <Form.Item
                      className={styles.ant}
                        name="user_name"
                        rules={[{ required: true, message: 'Please input your username!' }]}
                    >
                        <Input placeholder="请输入账号"/>
                    </Form.Item>

                    <Form.Item
                        className={styles.ant}
                        name="user_pwd"
                        rules={[{ required: true, message: 'Please input your password!' }]}
                    >
                        <Input.Password placeholder="请输入密码" />
                    </Form.Item>

                    <Form.Item>
                        <Button className={styles.btn} type="primary" htmlType="submit">
                           登录
                        </Button>
                    </Form.Item>
                    </Form>
                </Card>,
            </div>
        )
    }
}
